package com.bit.net;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 消息载体
 *
 * @since 2018/10/10
 */
@ToString
public abstract class MessageHolder<T> {

    @Getter
    @Setter
    private Header header;

    @Getter
    @Setter
    private T body;

    public MessageHolder(Header header, T body) {
        this.header = header;
        this.body = body;
    }

    static class Header {

        @Getter
        @Setter
        private String magicNumber;
        @Getter
        @Setter
        private int version;
        @Getter
        @Setter
        private int packageSize;
        @Getter
        @Setter
        private int cmd;
        @Getter
        @Setter
        private int reserve;
    }
}